import sys

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QGuiApplication
from pyqt_screenshot.screenshot import Screenshot, constant

if __name__ == "__main__":
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)

    qtApp = QApplication(sys.argv)
    # print(sys.argv)
    # screens = QGuiApplication.screens()
    # main_screen = QApplication.primaryScreen()
    # print(screens)
    # print(main_screen)
    user_input = input("请输入参数（按回车确认）: ")
    if(user_input == "start"):
        # print("start")
        window = Screenshot(constant.CLIPBOARD | constant.TEXT | constant.RECT | constant.ARROW | constant.FREEPEN
                            | constant.LINE | constant.ELLIPSE | constant.SAVE_TO_FILE)
        window.show()
        window.init_config(qtApp)
    # window2 = qtApp.activeWindow()
    # if window2:
    #     screen = QApplication.screenAt(window.pos())
    #     if screen:
    #         screen_index = screens.index(screen)
    #         print(f"当前窗口所在的屏幕索引为: {screen_index}")
    qtApp.exec()
